package top.malaoshi.netdisk.vo;

import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import top.malaoshi.jdbc.annotation.Result;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;

public class User {
    @JsonSerialize(using = ToStringSerializer.class)
    @Result(column="uid")
    private Long id;
    @NotNull(message = "登录名不能为空")
    @Size(min = 3, max = 16, message = "登录名长度必须在3-16之间")
    private String username;
    @NotNull(message = "密码不能为空")
    @Size(min = 5, max = 16, message = "密码长度必须在5-16之间")
    private String password;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getUsername() {
        return username;
    }

    public void setUsername(String username) {
        this.username = username;
    }

    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    @Override
    public String toString() {
        return "User{" +
                "id=" + id +
                ", username='" + username + '\'' +
                ", password='" + password + '\'' +
                '}';
    }
}
